Repository navigation
fix(service-storage): Setup storage Test connection answers in the caller's language (#30335) - #30627
Conversation
…ller's language The storage/test settings action writes its message in the locale the settings action route hands the handler (Accept-Language, else ?locale): success, probe mismatch and incomplete S3 settings in en, zh-CN, ja-JP and es-ES; an adapter's own error text stays verbatim behind a localized lead-in outside English. Absent or unknown locale answers in English. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CaWLG2RrgKub5oRNjC
…platform languages Adds zh-Hant, ar, fr, pt-BR, ru, de and ko to the storage/test copy table, reads the caller's code through platformLocaleTagOf (aliases and table tags) and then shorter subtags, and pins that every key carries every language. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CaWLG2RrgKub5oRNjC
📓 Docs Drift Check11 anchor(s) derived from 1 changed package(s); no hand-written page names any of them, so this run has nothing to list — not a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run. What this run could not see
Coarse fallback — 10 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 5080ecef6bce855c879ca63082250c036593845c && git checkout 5080ecef6bce855c879ca63082250c036593845c
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin aad1603cc2180b3eefa8cee41f5b895b8ee45909 47c43908c592df4ac5a26fc5488140d64c7b741e && git checkout -B drift-repro aad1603cc2180b3eefa8cee41f5b895b8ee45909 && git merge --no-ff 47c43908c592df4ac5a26fc5488140d64c7b741e
node scripts/docs-audit/affected-docs.mjs --json aad1603cc2180b3eefa8cee41f5b895b8ee45909 |
|
domain:server#2 · os-bill · session_01Utp6Cbvcmv8YWFhFJwzjKL 维护者速读
席位核对 — ACCEPT · domain:server#2 · head
|
Requested by Bill · project thread
domain:server#2 · os-bill · session_01Utp6CaWLG2RrgKub5oRNjC
维护者速读
Storage round-trip succeeded (adapter=local).,管理员可能读不懂下一步。fix: Setup form help speaks to an administrator; queue pages, mail status banner and test toast read in Chinese #30551 已让设置动作拿到调用者语言,本 PR 让存储这个按钮用上它。storage/test处理器和一个新文案文件;ok、severity、探针上传下载删除、运维日志都不变;英文调用方的句子一字不变。回滚即还原本 PR。packages/services/service-storage/src/storage-test-copy.ts(文案表与storageTestCopyLocaleOf语言查找);其次storage-service-plugin.ts里storage/test的四处copy.调用。pnpm --filter @objectstack/service-storage exec vitest run --maxWorkers=2 src/storage-test-locale.test.ts,预期 10 个全绿,第一个用例的消息是存储连接测试成功(适配器:local)。Refs #30335
Clause-②: no
Metadata-protocol: none
What changes
The console prints the
storage/testsettings action'smessageas the toast, bare. Since #30551 the settings action route hands each action handler the caller's display language as the input'slocale(Accept-Language, else?locale;settings-routes.tsrequestLocaleOf). The storage handler now writes its answer in that language.packages/services/service-storage/src/storage-test-copy.ts: one entry per language on the platform locale table (PLATFORM_LOCALES):en,zh-CN,zh-Hant,es-ES,ar,fr,pt-BR,ru,de,ja-JP,ko. The four codes this package's bundles already used keep their keys. Four sentences each: success (still names the adapter), probe read back not the one written, S3 settings missing a bucket or a region, and a lead-in for an adapter's own error.storage/testreadslocalefrom the handler input, the same source as the mail test notice in fix: Setup form help speaks to an administrator; queue pages, mail status banner and test toast read in Chinese #30551. The adapter's own error text (S3 SDK, file system) stays verbatim: alone in English, as before; in another language behind the lead-in (存储连接测试失败:…), so the reader knows the rest is the adapter's untranslated report.buildAdapterFromValuesthrows a newS3SettingsIncompleteErrorwith the same English message as before, so the settings re-apply path and itswarnlog line are byte-identical; only thestorage/testanswer reads the type to localise the refusal.ok,severity, the adapter name, the probe and its cleanup, everyctx.loggerline, and every sentence an English or locale-less caller gets.Where the strings live, and one deviation from the precedent. The precedent is #30376 (
mfa-required-enrollment-predicate.ts): a settings handler's prose sits in a module-level copy table beside its code, not in the package'stranslations/bundles (those carry object metadata). This PR follows it, with one difference: the lookup does not use@objectstack/core'sresolveLocale. With bothzh-CNandzh-Hantin one table, that ladder's base-language and first-variant steps answerzh-TWby key order, which is the trap the platform table's own reader warns about (packages/spec/src/system/platform-locales.ts, theplatformLocaleTagOfnote). SostorageTestCopyLocaleOfreads the caller's code throughplatformLocaleTagOf(aliaseszh-TW,pt,en-US; table tagszh-Hans,ja), then drops one subtag at a time (RFC 4647 lookup:fr-CA→fr,zh-Hant-TW→zh-Hant), and falls back to English. This is the gap #30538 names (resolveBundleLocale/resolveLocaledo not readplatformLocaleTagOf); once #30538 lands this module can go back to the shared resolver.Tests
New
packages/services/service-storage/src/storage-test-locale.test.ts, 10 cases, all through the REAL handler the plugin registers, on a real local adapter, with the inputlocaleset or absent:ok: true,severity: 'info'; en-US success is the old English sentence;tr-TR(not on the table) and''answer the old English sentence;zhresolves to the zh-CN copy;ok: false,severity: 'error'), and the probe object is still removed;PLATFORM_LOCALE_TAGStag finds its own entry;Existing pins in
storage-service-plugin.test.tsandstorage-service-plugin.probe-cleanup-store.test.ts(English messages, no locale) pass unchanged.Acceptance notes
c23eafa8):locale: 'zh-CN'and no locale both answeredStorage round-trip succeeded (adapter=local).; mismatchProbe download did not match upload.; S3StorageServicePlugin: S3 adapter requires s3_bucket and s3_region.Clause-②: no: nothing outside this package's own tests matches the English text (git grep -n "round-trip succeeded\|did not match upload"hits onlyservice-storage). The console prints the message and readsok.dir.SettingsService+ routes was not added here: service-storage has no service-settings dependency, and fix: Setup form help speaks to an administrator; queue pages, mail status banner and test toast read in Chinese #30551 pins the route → handlerlocalehop.Verification
All on head
47c43908c(merge ofmainatbdbaf80c, which carries #30551).Local runs
pnpm --filter @objectstack/service-storage test: Test Files 73 passed (73), Tests 1353 passed (1353).pnpm --filter @objectstack/service-storage typecheck: exit 0 (check:test-typecheck: OK).node scripts/check-i18n-bundles.mjs: exit 0 (10 packages, all bundles in sync).node scripts/pm/dispatch-gates.mjs --commands: 62 derived families, all 62 exit 0;--ran: 62 derived, 62 run, 0 NOT-MEASURED.eslint --no-inline-configon the three changed source files: exit 0.pnpm --filter '@objectstack/dogfood^...' build && pnpm --filter @objectstack/dogfood test):VERDICT command-exit 0, Test Files 420 passed, 3 skipped (423); Tests 3496 passed, 36 skipped (3532).Ablations (scripts/ablation-replace.mjs, each restored, git diff HEAD empty after)
locale: 5 failed, 5 passed (the five zh cases).en→zh-CN: 4 failed (no-locale English, no-locale S3, the lead-in case, the mapping pin).koentry: 1 failed (all 11 languages pin).🤖 Generated with Claude Code
https://claude.ai/code/session_01Utp6CaWLG2RrgKub5oRNjC